package com.zbkj.service.model.front.vo.fund;

import com.zbkj.dal.entity.fund.UserWithdrawRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
@ApiModel
public class WithdrawDetailVO {

    /**
     * 提现单号
     */
    @ApiModelProperty(value = "提现单号", example = "UWewfhlsdlahfdksdfdsz")
    private String withdrawNo;

    /**
     * 银行名称
     */
    @ApiModelProperty(value = "银行名称", example = "中国建设银行")
    private String bankName;

    @ApiModelProperty(value = "银行卡号后四位", example = "2021")
    private String bankcardNumber;

    /**
     * 订单总金额
     */
    @ApiModelProperty(value = "订单总金额", example = "100.00")
    private BigDecimal withdrawAmount;

    /**
     * @see com.zbkj.dal.base.enums.WithdrawStatusEnums
     */
    @ApiModelProperty(value = "提现交易状态", example = "WAIT_AUDIT")
    private String status;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注", example = "")
    private String remark;

    public static WithdrawDetailVO getWithdrawDetailVO(UserWithdrawRecord userWithdrawRecord) {
        WithdrawDetailVO withdrawDetailVO = new WithdrawDetailVO();
        withdrawDetailVO.setWithdrawNo(userWithdrawRecord.getWithdrawNo());
        withdrawDetailVO.setBankName(userWithdrawRecord.getBankName());
        String bankcardNumber = userWithdrawRecord.getBankcardNumber();
        withdrawDetailVO.setBankcardNumber(bankcardNumber.substring(bankcardNumber.length() - 4));
        withdrawDetailVO.setWithdrawAmount(userWithdrawRecord.getWithdrawAmount());
        withdrawDetailVO.setStatus(userWithdrawRecord.getStatus());
        withdrawDetailVO.setRemark(userWithdrawRecord.getRemark());
        return withdrawDetailVO;
    }
}
